package com.easemob.chat;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import com.easemob.util.EMLog;

public class EMChatService extends Service
{
  private static final String TAG = "chatservice";
  private final IBinder mBinder = new LocalBinder();

  public void onCreate()
  {
    super.onCreate();
    EMLog.i("chatservice", "chat service created");
  }

  public int onStartCommand(Intent paramIntent, int paramInt1, int paramInt2)
  {
    if (paramIntent != null)
    {
      String str = paramIntent.getStringExtra("reason");
      if ((str != null) && (str.equals("boot")))
      {
        EMLog.d("chatservice", "start service from boot ,need to login");
        EMChat.getInstance().init(getApplicationContext());
      }
    }
    return 1;
  }

  public void onDestroy()
  {
    EMLog.d("chatservice", "onDestroy");
    try
    {
      if (!EMChatManager.getInstance().stopService)
        EMChatManager.getInstance().doStartService();
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }

  public IBinder onBind(Intent paramIntent)
  {
    EMLog.d("chatservice", "onBind");
    return this.mBinder;
  }

  public boolean onUnbind(Intent paramIntent)
  {
    return true;
  }

  public class LocalBinder extends Binder
  {
    public LocalBinder()
    {
    }

    EMChatService getService()
    {
      return EMChatService.this;
    }
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     com.easemob.chat.EMChatService
 * JD-Core Version:    0.6.1
 */